package day06;
import java.util.Arrays;
public class Test {
    public static void main(String[] args) {

        /*
        //1)
        int[] arr = new int[10];
        for (int i = 0;i<arr.length;i++){
            arr[i] = (int) (Math.random()*100);
            System.out.println(arr[i]);
        }
        int max = arr[0];
        for (int i = 1;i<arr.length;i++){
            if (arr[i]>max){
                max = arr[i];
            }

        }
        System.out.println("最大值为："+max);
        arr = Arrays.copyOf(arr,arr.length);
        arr[arr.length-1] = max;
        for (int i =0;i<arr.length;i++){
            System.out.println(arr[i]);
        }

         */



        /*
        int[] arr = new int[10];
        for (int i =0;i<arr.length;i++){
            arr[i] = (int) (Math.random()*100);
            System.out.println(arr[i]);
        }
        int max  = arr[0];
        for (int i  =0;i<arr.length;i++){
            if (arr[i]>max){
                max = arr[0];
            }
        }
        System.out.println("最大值为："+max);

        arr = Arrays.copyOf(arr,arr.length-1);
        arr[arr.length-1] = max;
        for (int i =0;i<arr.length-1;i++){
            System.out.println(arr[i]);
        }

         */
























        /*
        //2)
        say();
        sayHi("LY");
        sayHello("LY",100);
        double a =getNum();

        int b = plus(4,10);

        int c = 4, d = 10;

        int e  = plus(c,d);

        int[] b1 = testArray(5,20);
        System.out.println("数组的长度为："+b1.length);
        for (int i = 0;i<b1.length;i++){
            System.out.println(b1[i]);
        }

        int[] b2 = testArray(6,60);
        System.out.println("第一个元素的值为："+b2[0]);
        for (int i =0;i<b2.length;i++){
            System.out.println(b2[i]);
        }
        System.out.println("继续执行...");

         */

        say();
        sayHi("LY");
        sayHello("LY",100);

        double a = getNum();
        System.out.println(a);

        int b =plus(4,9);
        System.out.println(b);

        int c = 4,d = 9;
        int e = c+d;
        System.out.println(e);

        int[] b2 = testArray(8,60);
        System.out.println("数组的长度为："+b2.length);
        for (int i = 0;i<b2.length;i++){
            System.out.println(b2[i]);
        }

        int[] b3 = testArray(9,500);
        System.out.println("第一个元素的值为："+b3[0]);
        for (int i =0;i<b3.length;i++){
            System.out.println(b3[i]);
        }
        System.out.println("继续执行...");










    }
    /*
    public static void say(){
        System.out.println("大家好，我叫LY，今年100岁了");
    }
    public static void sayHi(String name){
        System.out.println("大家好，我叫"+name+"今年100岁了");
    }
    public static void sayHello(String name,int age){
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁了");
    }
    public static double getNum(){
        return 8.88;
    }
    public static int plus(int num1,int num2){
        int num = num1+num2;
        return num;
    }
    public static int[] testArray(int a1,int a2){
        int[] arr = new int[a1];
        for (int i =0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*(100+1));
        }
        return arr;


    }

     */



    public static void say(){

        System.out.println("大家好，我是LY，今年100岁了");
    }
    public static void sayHi(String name){

        System.out.println("大家好，我是"+name+"，今年100岁了");
    }
    public static void sayHello(String name,int age){

        System.out.println("大家好，我是"+name+"，今年"+age+"岁了");
    }
    public static double getNum(){

        return  8.88;
    }
    public static int plus(int num1,int num2){
        int num = num1+num2;
        return num;
    }
    public static int[] testArray(int a1,int a2){
        int[] arr = new int[a1];
        for (int i =0;i<arr.length;i++){
            arr[i] = (int) (Math.random()*(100+1));
        }
        return arr;

    }


}
